<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //请写一个函数，打印一个字符串中的第一个不重复的字符
      
      function fn(str) {
        let arr = []
        for (let i = 0; i < str.length; i++) {
          let str1 = str.slice(0, i) + str.slice(i + 1)
          arr.push(str1.indexOf(str[i]))
        }
        arr.indexOf(-1) === -1 ? console.log(-1) : console.log(str[arr.indexOf(-1)])
      }
      fn()
    </script>
  </body>
</html>
